Skip to main content

How to modify SUICheckBox target by script using Java

In your Java class, do the following:

public class YourClass extends Component {

// create a new SpatialObject
public SpatialObject object; // select in properties

// creates a new STargetRect
public STargetRect type; // select in properties

// creates a new SUICheckBox, @AutoWired selects the component from this object
@AutoWired
private SUICheckBox checkBox;

@Override
public void start() {

}

@Override
public void repeat() {

// change type of touch area of ​​SUICheckBox
checkBox.setTargetRectType(type);

// defines the object (a SUI component) which will be the touch area of ​​the SUICheckBox
checkBox.setTargetRectObject(object);
}
}